﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using UniversityManagementSystem.DAL;
using UniversityManagementSystem.Manager;

namespace UniversityManagementSystem.UI
{
    public partial class ViewAllDepartment : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if(!Page.IsPostBack)
                {
                    List<Department> allDepartments = new List<Department>();
                    Department department = new Department();
                    allDepartments = department.GetAllDepartments();
                    departmentGridView.DataSource = allDepartments;
                    departmentGridView.DataBind();
                }
            }
            catch (Exception)
            {
                Response.Redirect(@"ViewAllDepartment.aspx?message=" + "Error while loading the page,Please try again later");
            }
        }
    }
}